package excutors;

import java.util.concurrent.FutureTask;

public class FutureDemo {
    public static void main(String[] args) throws Exception{

        Runnable runnable = new Runnable() {
            @Override
            public void run() {
                System.out.println("======执行runnable接口=====带有返回值");
            }
        };
        FutureTask task1 = new FutureTask(runnable,100);

        new Thread(task1).start();
        try {
            System.out.println(task1.get());
        } catch (Exception e) {

        }
        /**
         * ======执行runnable接口=====带有返回值
         * 100
         */
//        FutureTask task=new FutureTask(new Callable() {
//            @Override
//            public Object call() throws Exception {
//                System.out.println("执行返回结果");
//                return 10;
//            }
//        });




    }
}
